<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" isELIgnored="false"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib  prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
   <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<font size="2">
<table width="100%" border="0" >
	<tr>
		<td colspan="6">
			<img src="img/main_board.png">
		</td>
	</tr>
	<tr CLASS="tableLine"  align="center"
		style="background-color:#f6f6f6;">
		<td width="6%"></td>
		<td width="14%"></td>
		<td width="45%"></td>
		<td width="10%" align="left"></td>
		<td width="14%"></td>
		<td width="6%"></td>
	</tr>		
		<c:forEach var="bvo" items="${requestScope.alvo.list}">
			<tr CLASS="tableLine" align="center">
			    <td>${bvo.content_no }</td>
			    <td>
			    	<c:forEach items="${sessionScope.list }" var="vo">
				    	<c:if test="${bvo.board_no==vo.board_no }">
				    		${vo.name }
				    	</c:if>
			    	</c:forEach>
			    </td>
				<td align="left"><c:if test="${bvo.restep>0 }">
						<c:forEach begin="1" end="${bvo.relevel }">
						<img src="img/board/blank.jpg">
						</c:forEach>
						<img src="img/board/icon-reply.gif">
					</c:if>
				<c:forEach items="${sessionScope.list }" var="vo">
	    		<!-- 우선, 같은 session에 걸린 board_no와 일치시키고 -->
		    		<c:if test="${bvo.board_no==vo.board_no }">
						<a href="board.do?command=showContent&no=${bvo.content_no }&kind=${vo.kind }&view=${param.view }">
						${bvo.title }</a>
						<c:if test="${bvo.newfilename!=null }"><!-- 게시물에 파일첨부 되어 있으면 -->
							<c:choose>
							<c:when test="${vo.kind=='file' }"> <!-- 파일게시판이면  디스켓 아이콘 -->
								<img src="img/board/icon-file.jpg">
							</c:when>
							<c:when test="${vo.kind=='picture' }"><!-- 사진게시판이면 사진 아이콘 -->
								<img src="img/board/icon-pic.jpg">
							</c:when>
							</c:choose>
						</c:if>
					</c:if>
				</c:forEach>
				<c:if test="${bvo.refly_count>0 }"><!-- 덧글이 달려있으면 덧글 수 출력 -->
					<font size="1" color="#DB631F">[<b>${bvo.refly_count }</b>]</font>
				</c:if>
				<!-- 위 선언부에 하나 추가!  
					 현재 시간을 받아오는 부분 
					 new Data() -> Wed May 09 14:33:36 KST 2012 이런 형식으로 표현된다. -->
				<c:set var="currentDate" value="<%=new Date() %>"/>
				<!-- new Data() 를 2012.5.9 으로 바꿔주는데 
				pattern 속성을 이용해 2012.05.09 형태 등등 표현 가능 -->
				<fmt:formatDate pattern="YYYY.MM.dd" var="curData" value="${currentDate}" type="date"/>	
				 <c:if test="${bvo.writeDate==curData }">
				 	<img src="img/board/new.png">
				</c:if>
				</td>
				<td align="left">${bvo.nick }</td>
				<td>${bvo.writeDate }</td>
				<td>${bvo.count }</td>
			</tr>
			<tr>
				<td colspan="6">
					<img src="img/main_line.png">
				</td>
			</tr>
		</c:forEach>
</table><br>
	<center>
	<!-- 페이징 처리 -->	
	<%-- 이전 버튼 --%>
	 <c:if test="${requestScope.alvo.pagingBean.previousPageGroup}">
	 	<c:choose>
		<c:when test="${requestScope.alvo.pagingBean.isSearch }"> <!-- 검색한 결과이면 -->
			<a href=
			"cafe.do?command=searchAllBoard&type=paging&pageNo=${requestScope.alvo.pagingBean.
			startPageOfPageGroup-1}&kind=${param.kind }&view=${param.view }&searchKind=${param.searchKind }&str=${param.str }"><img src="img/board/left_arrow_btn.gif"></a>
		</c:when>
		<c:otherwise>
			<a href=
			"cafe.do?command=cafe&type=paging&pageNo=${requestScope.alvo.pagingBean.
			startPageOfPageGroup-1}&kind=${param.kind }&view=${param.view }"><img src="img/board/left_arrow_btn.gif"></a>
		</c:otherwise>
		</c:choose>
	 </c:if>
	<%-- 페이지 번호 --%>	
	<c:forEach var="i" 
	begin="${requestScope.alvo.pagingBean.startPageOfPageGroup}"
	 end="${requestScope.alvo.pagingBean.endPageOfPageGroup}">
	 <c:choose>
	 <c:when test="${requestScope.alvo.pagingBean.nowPage!=i}">
		 <c:choose>
		 <c:when test="${requestScope.alvo.pagingBean.isSearch }"><!-- 검색한 결과이면 -->
	 		<a class="n" href="cafe.do?command=searchAllBoard&type=paging&pageNo=${i}&kind=${param.kind }&view=${param.view }&searchKind=${param.searchKind }&str=${param.str }">${i}</a>
	 	</c:when>
	 	<c:otherwise>
	 		<a class="n" href="cafe.do?command=cafe&type=paging&pageNo=${i}&kind=${param.kind }&view=${param.view }">${i}</a>
	 	</c:otherwise>
	 	</c:choose>
	 </c:when>
	 <c:otherwise>
	<b><font color="#DB631F" style="text-decoration: underline;">${i}</font></b>
	</c:otherwise>
	</c:choose>
	</c:forEach>
	<%-- 다음 버튼 --%>
	 <c:if test="${requestScope.alvo.pagingBean.nextPageGroup}">
	 <c:choose>
	 <c:when test="${requestScope.alvo.pagingBean.isSearch }"><!-- 검색한 결과이면 -->
	 	<a href=
		 "cafe.do?command=searchAllBoard&type=paging&pageNo=${requestScope.alvo.pagingBean.
		 endPageOfPageGroup+1}&kind=${param.kind }&view=${param.view }&searchKind=${param.searchKind }&str=${param.str }">
		 <img src="img/board/right_arrow_btn.gif">
		 </a>
	 </c:when>
	 <c:otherwise>
		 <a href=
		 "cafe.do?command=cafe&type=paging&pageNo=${requestScope.alvo.pagingBean.
		 endPageOfPageGroup+1}&kind=${param.kind }&view=${param.view }">
		 <img src="img/board/right_arrow_btn.gif">
		 </a>
	 </c:otherwise>
	 </c:choose>
	 </c:if>
</center>
</font>
</body>
</html>